package com.woniuxy.intellihome.controller.ucenter;


import com.woniuxy.intellihome.entity.Region;
import com.woniuxy.intellihome.entity.ResponseEntity;
import com.woniuxy.intellihome.entity.ResponseState;
import com.woniuxy.intellihome.service.RegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2021-08-11
 */
@RestController
@RequestMapping("ucenter/region")
public class RegionController {
    @Autowired
    private RegionService regionService;

    @GetMapping("getRegion")
    public ResponseEntity getRegion(Region region) {
        ResponseEntity responseEntity = new ResponseEntity();
        List<Region> regions = regionService.getByPid(region);

        responseEntity.setMsg("查询成功");
        responseEntity.setCode(ResponseState.SUCCESS);
        responseEntity.setData(regions);
        return responseEntity;
    }
}

